Open
Conversation
b514e8c to
4b54f5f
Compare
rover0811
reviewed
Oct 17, 2025
Member
rover0811
left a comment
There was a problem hiding this comment.
결과를 맞춰보세요!
def uppercase(func):
def wrapper():
result = func()
return result.upper()
return wrapper
def add_exclamation(func):
def wrapper():
result = func()
return result + "!"
return wrapper
@uppercase
@add_exclamation
def greet():
return "hello"
print(greet()) # 결과는? "HELLO!" vs "hello!".upper()?
| numbers = [1, 2, 3, 4, 5] | ||
| first, *middle, last = numbers | ||
| print(first, middle, last) | ||
| # 1 {2,3,4}, 5 |
| date2 = [] | ||
| for i in range(1,6): | ||
| for j in range(1,4): | ||
| data2.append((i,j)) |
|
|
||
| ```python | ||
| lst=[x*2 for x in range(5)] | ||
| gen=(x*2 for x in range(5)) |
Member
There was a problem hiding this comment.
list(gen) # [0, 2, 4, 6, 8]
list(gen) # ??? -> 여기서 뭐가 나올까요?
| yield 1 | ||
| yield 2 | ||
| yield 3 | ||
|
|
Member
There was a problem hiding this comment.
def gen_with_return():
yield 1
yield 2
return "끝" # 이 값은 어떻게 접근할까요?
yield 3 # 이건 실행될까요?
| self.x, self.y = x, y | ||
|
|
||
| def __eq__(self, other): | ||
| return self.x == other.x and self.y == other.y |
Member
There was a problem hiding this comment.
__eq__를 구현하면 왜 __hash__도 필요할까?
set이나 dict의 키로 사용할 때 어떤 문제가 생길까요?
Python은 왜 자동으로 해시를 무효화할까요?
| return func(*args, **kwargs) #7 | ||
|
|
||
| return sentence #4 | ||
|
|
Member
There was a problem hiding this comment.
functools.wraps에 대해 좀 더 찾아보면 좋을 것 같아요.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
학습 내용 요약
__str__vs__repr__와 매직메서드의 역할핵심 개념
실습 예제
개념을 정리한 md 파일에 예제 코드를 참조함
참고 자료
https://tibetsandfox.tistory.com/25
https://tibetsandfox.tistory.com/28
https://tibetsandfox.tistory.com/39
https://tibetsandfox.tistory.com/42
https://tibetsandfox.tistory.com/10
체크리스트